import Vue from 'vue'
import App from './App.vue'
// 引入路由对象
import router from './router'

// 引入store对象
import store from './store'
// 引入全局组件
// 三级分类组件
import TypeNav from './components/TypeNav'
//引入分页组件
import Pagination from './components/Pagination'
// 引入模态框组件
import Dialog from '@/components/Dialog'

// 启动mock服务器，一旦加载了mockServer.js文件，就相当于开启了mock服务器
import '@/mock/mockServer'

// 引入swiper样式
import 'swiper/css/swiper.min.css'

// 引入图片懒加载
import VueLazyLoad from 'vue-lazyload'
import loading from '@/assets/loading.gif'

// 实现图片懒加载
Vue.use(VueLazyLoad, {
  loading,
})

import { Message } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css' //引入样式
Vue.prototype.$message = Message
Vue.use(Message)

Vue.component(TypeNav.name, TypeNav)
Vue.component(Pagination.name, Pagination)
Vue.component(Dialog.name, Dialog)

Vue.config.productionTip = false
new Vue({
  render: (h) => h(App),
  router,
  store,
  // 添加全局事件总线
  beforeCreate() {
    Vue.prototype.$bus = this
  },
}).$mount('#app')
